


'use strict';

//用户信息相关
angular.module('mean.employ')
    .controller('UserInfoController', function($scope, $state) {
        $scope.edit = function() {
            $state.go('user.editUserInfo');
        };
        $scope.$watch('publicData.userInfo.status', function() {
            if($scope.publicData.userInfo.status === 0) {$scope.status = '审核中';}
            if($scope.publicData.userInfo.status === 1) {$scope.status = '已审核';}
            if($scope.publicData.userInfo.status === 2) {$scope.status = '审核不通过';}
        });
    })
    .controller('EditUserInfoController', function($scope, $http) {
        $scope.birth = new Date($scope.publicData.userInfo.birth);
        $scope.save = function() {
            // $scope.publicData.userInfo.birth = $scope.birth;
            $http.put('/wx/employ/userInfo', {
                userInfo: $scope.publicData.userInfo
            }).then(function(success) {
                return $scope.refreshData();
            }).then(function(success) {
                $scope.goBack();
            });
        };
        $scope.cb = function(val) {
            $scope.publicData.userInfo.birth = val;
        };
    })
;